import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '物料名称',
    align: 'left',
    dataIndex: 'materialName'
   },
   {
    title: '物料编码',
    align: 'center',
    dataIndex: 'materialCode'
   },
   {
    title: '物料图片',
    align: 'center',
    dataIndex: 'materialPic',
    customRender:render.renderImage,
   },
   {
    title: '备注',
    align: 'center',
    dataIndex: 'materialDesc',
   },
   {
    title: '关联请假',
    align: 'center',
    dataIndex: 'glqj'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '物料名称',
    field: 'materialName',
    component: 'Input',
  },
  {
    label: '物料编码',
    field: 'materialCode',
    component: 'Input',
  },
  {
    label: '父级节点',
    field: 'pid',
    component: 'JTreeSelect',
    componentProps: {
      dict: "material,material_name,id",
      pidField: "pid",
      pidValue: "0",
      hasChildField: "has_child",
    },
  },
  {
    label: '物料图片',
    field: 'materialPic',
     component: 'JImageUpload',
     componentProps:{
        fileMax: 0
      },
  },
  {
    label: '备注',
    field: 'materialDesc',
    component: 'JEditor',
  },
  {
    label: '关联请假',
    field: 'glqj',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  materialName: {title: '物料名称',order: 0,view: 'text', type: 'string',},
  materialCode: {title: '物料编码',order: 1,view: 'text', type: 'string',},
  materialPic: {title: '物料图片',order: 3,view: 'image', type: 'string',},
  materialDesc: {title: '备注',order: 4,view: 'umeditor', type: 'string',},
  glqj: {title: '关联请假',order: 5,view: 'link_table', type: 'string',},
};


/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
